package com.antilia.infomaresme.pages.edit;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.odlabs.wiquery.ui.button.ButtonBehavior;

/**
 * @author Ernesto Reinaldo Barreiro
 *
 */
public abstract class ConfirmationPanel extends Panel {

	private static final long serialVersionUID = 1L;

	/**
	 * @param id
	 * @param model
	 */
	public ConfirmationPanel(String id, IModel<String> message) {
		super(id, message);		
		add(new Label("message", message));
		
		AjaxLink<Void> ok = new AjaxLink<Void>("ok") {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				ConfirmationPanel.this.onOk(target);
			}
		};
		ok.add(new ButtonBehavior());
		add(ok);
		
		AjaxLink<Void> cancel = new AjaxLink<Void>("cancel") {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				ConfirmationPanel.this.onCancel(target);
			}
		};
		cancel.add(new ButtonBehavior());
		add(cancel);
	}
	
	public abstract void onOk(AjaxRequestTarget target);


	public abstract void onCancel(AjaxRequestTarget target);
}
